
//mobile:/^(13[0-9]|15[0-9]|18[0-9])\d{8}$/
//email:^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
var validatePattern = {	
	Email : /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
	Phone : /^((\(\d{3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}$/,
	//Mobile : /^((\(\d{3}\))|(\d{3}\-))?13\d{9}$/,
	Mobile : /^(13[0-9]|15[0-9]|18[0-9])\d{8}$/,
	Mobile_yd:/^(134|135|136|137|138|139|150|151|152|157|158|159|187|188|147|182|188)\d{8}$/,
	Url : /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,
	IdCard : /^\d{15}(\d{2}[A-Za-z0-9])?$/,
	Currency : /^\d+(\.\d+)?$/,
	Number : /^\d+$/,
	Zip : /^[1-9]\d{5}$/,
	QQ : /^[1-9]\d{4,8}$/,
	Integer : /^[-\+]?\d+$/,
	Double : /^[-\+]?\d+(\.\d+)?$/,
	English : /^[A-Za-z]+$/,
	Chinese :  /^[\u0391-\uFFE5]+$/,
	InputZZ : /^(\w|[\u0391-\uFFE5])+$/, //汉字,数字、26个英文字母或者下划线
	Ip : /^\d+\.\d+\.\d+\.\d+$/
	,validateEmpty : function(param,out){
		var newParam = param.replace(/(^\s*)|(\s*$)/g, "")
		if (newParam!=""){
			return true;
		}else{
			if(out==true){
				myAlert("请输入信息");
			}
			return false;
		}	
	}
	,validateEmail : function(param,out){
		if (this.Email.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("请输入正确的电子信箱");
			}
			return false;
		}
	}
	
	,validatePhone : function(param,out){
		if (this.Phone.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("请输入正确的固定电话号码");
			}
			return false;
		}
	}
	,validateMobile : function(param,out){
		if (this.Mobile.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("请输入正确的移动电话号码");
			}
			return false;
		}
	}
	,validateMobile_yd:function(param,out)
	{
		if(this.Mobile_yd.exec(param))
		{
			return true;
		}
		else
		{
			if(out==true)
			{
				myAlert("请输入正确的移动电话号码");
			}
			return false;
		}
	}
	,validateUrl : function(param,out){
		if (this.Url.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("请输入正确的连接地址");
			}
			return false;
		}
	}
	,validateIdCard : function(param,out){
		if (this.IdCard.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("请输入正确的身份证号码");
			}
			return false;
		}
	}
	,validateNumber : function(param,out){
		if (this.Number.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("请输入正确的数字");
			}
			return false;
		}
	}
	,validateZip : function(param,out){
		if (this.Zip.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("请输入正确的邮政编码");
			}
			return false;
		}
	}
	,validateQQ : function(param,out){
		if (this.QQ.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("请输入正确的QQ号码");
			}
			return false;
		}
	}
	,validateInteger : function(param,out){
		if (this.Integer.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("请输入正确的整数类型");
			}
			return false;
		}
	}
	,validateDouble : function(param,out){
		if (this.Double.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("请输入正确的浮点数类型");
			}
			return false;
		}
	}
	,validateEnglish : function(param,out){
		if (this.English.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("输入只能是英文");
			}
			return false;
		}
	}
	,validateChinese : function(param,out){
		if (this.Chinese.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("输入只能是汉字");
			}
			return false;
		}
	}
	,validateInputZZ : function(param,out){
		if (this.InputZZ.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("输入只能是[汉字,数字、26个英文字母或者下划线]");
			}
			return false;
		}
	}
	,validateIp : function(param,out){
		if (this.Ip.exec(param)){
			return true;
		}else{
			if(out==true){
				myAlert("输入的IP地址不正确");
			}
			return false;
		}
	}
	,validateTwoTime : function(activeTime , inactiveTime , out ){
		var inactDateValue = inactiveTime;
		var returnBool = true;
		if(inactDateValue != '' ){
			var actDateValue = activeTime;
			if(actDateValue != '' ){
				var actDates = actDateValue.split('-');
				var inactDates = inactDateValue.split('-');
				if(inactDates[0] < actDates[0]){
					returnBool = false;
				}else if(inactDates[0] == actDates[0]){
					if(inactDates[1] < actDates[1]){
						returnBool = false;
					}else if(inactDates[1] == actDates[1]){
						if(inactDates[2] <= actDates[2]){
							returnBool = false;
						}
					}
				} 
			}
		}
		if(out==true&&(!returnBool)){
			myAlert('后时间不能大于等于前时间');
		}
		return returnBool;
		
		/*
比较两个日期大小
function compareDate(d1,d2)
{
    return ((new Date(d1.replace(/-/g,"\/"))) < (new Date(d2.replace(/-/g,"\/"))));
}  
		 *
		 */
	}

}